import L_Run from "../utils/L_Run"
import * as CJD from "../types/define";
import ItemXManager from "../module/obj_container/ItemXManager";
import RewardManager from "../module/reward_about/RewardManager";
import UnitXManager from "../module/obj_container/UnitXManager";
import SkillUICreator from "../ui/skill/SkillUICreator";
import PlayerLearnedSkillsManager from "../skill/playerheroskillmanager/PlayerLearnedSkillsManager";

/** 一些测试触发 */
export default class TestTrg{

    /**测试命令强化触发 */
    private static testOrderEnhTrg:any=undefined

    /**触发器初始化 */
    public static init(){
        console.log("testTrg 准备创建")
        this.testOrderEnhTrg=L_Run.CreateTrigger_L()

        /**测试命令发布强化物品触发 */
        L_Run.initAllPlayerEvent((index:number)=>{TriggerRegisterPlayerUnitEvent(this.testOrderEnhTrg, Player(index), CJD.EVENT_PLAYER_UNIT_ISSUED_ORDER(), null)})
        console.log("testTrg 添加事件完成")
        TriggerAddAction(this.testOrderEnhTrg,()=>{
            //发布巡逻命令 强化一次第一格装备
            if (GetIssuedOrderId() == OrderId("stop")){
                console.log("testTrg 检测到触发stop事件")
                let it:item=UnitItemInSlot(GetTriggerUnit(), 0)
                if(it!=null){
                    ItemXManager.enhItem(1,GetTriggerUnit(),it,{attrs:{atk:5,def:5}})
                }else{
                    console.log("0格没有检测到装备!")
                }
            }else{

                // RewardManager.createRewardForUnit(UnitXManager.getUnitx(GetTriggerUnit()),3)    
                // RewardManager.createRewardForUnit(UnitXManager.getUnitx(GetTriggerUnit()),3)  

        
                //为玩家1添加Q系技能
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"IAXA",200)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"SHEW",300)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"XUZH",500)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"ZHUA",200)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"LUAN",300)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"PIKK",500)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"BKBA",200)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"SHOJ",300)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"DILE",300)

                //为玩家1添加W系技能
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"YZJL",200)
                PlayerLearnedSkillsManager.playerSkillLearnAndSyncHeroData(1,"DUDU",500)

                console.log("testTrg 检测到触发事件id:",GetIssuedOrderId())
            }
        })
        console.log("testTrg 创建完成")


    }

  
}  